package com.xx.cloud.pay.entity;


import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonInclude;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

//@TableName(value = "user", autoResultMap = true)
@Data
@Accessors(chain = true)

//@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class User implements Serializable {

    private static final long serialVersionUID = 42L;

    @TableId(type = IdType.ASSIGN_UUID)
//    @ExcelProperty(value = {"主键"},order = 1)
    private String id;

    @NotNull(message = "名称不能为空")
    @NotBlank(message = "名称不能为空")

    @ExcelProperty(value = {"名称"},index = 0)
    private String name;


    @TableField(fill = FieldFill.INSERT)
//    @ExcelProperty(value = {"创建时间"},order = 3)
    private Date createTime;


    @TableField(fill = FieldFill.UPDATE)
//    @ExcelProperty(value = {"更新时间"},order = 4)
    private Date updateTime;

    /**
     * 不是数据库字段
     */
    @TableField(exist = false)
    @ExcelProperty(value = {"性别"},index = 1)
    private String sex;


    @TableField(exist = false)
    @ExcelProperty(value = {"地址"},order = 3)
    private String address;


    @TableField(exist = false)
    @ExcelProperty(value = {"电话"},index = 2)
    private String phone;


    @TableField(typeHandler = JacksonTypeHandler.class)
//    @ExcelProperty(value = {"动态字段"},order = 8)
    private Object json;
}
